feat: add Trae command adapter#1090
Conversation
- Added Trae command adapter for generating `.trae/commands/opsx-<id>.md` files - Complete unit tests (9 test cases) and integration tests - Updated documentation and .gitignore - Fixed YAML escaping for carriage returns (\r) Co-Authored-By: Claude Code <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughHidden review stack artifactWalkthroughThis PR introduces a complete TRAE command adapter for generating Trae IDE command markdown files. The implementation adds a new ChangesTRAE Command Adapter Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/command-generation/adapters/trae.ts`:
- Around line 14-27: escapeYamlValue currently returns an unquoted empty scalar
for empty strings which YAML parses as null; add an explicit check at the start
of escapeYamlValue (the function named escapeYamlValue) to return a quoted empty
string literal (e.g. "\"\"") when value === '' before running the needsQuoting
regex/escape logic so empty-string metadata is preserved as a string in YAML
frontmatter.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 29f17e78-a3af-4ebd-9bad-402ab2170ede
📒 Files selected for processing (7)
.changeset/add-trae-command-adapter.md.gitignoredocs/supported-tools.mdsrc/core/command-generation/adapters/trae.tssrc/core/command-generation/registry.tstest/core/command-generation/adapters.test.tstest/core/init.test.ts
- Add explicit check for empty string in escapeYamlValue - Return quoted empty string '""' instead of unquoted empty scalar - Update test to verify empty string is properly quoted Co-Authored-By: Claude Code <noreply@anthropic.com>
Summary
.trae/commands/opsx-<id>.mdfilesContext
Trae IDE now supports custom slash commands via
.trae/commands/directory. This PR adds a command adapter to align Trae with other tools (Claude, Cursor, Windsurf) that use command adapters for the opsx workflow.The adapter generates Markdown files with YAML frontmatter (name, description) following Trae's command specification.
Changes
src/core/command-generation/adapters/trae.ts- New Trae command adaptersrc/core/command-generation/registry.ts- Register adapter in registrytest/core/command-generation/adapters.test.ts- Unit teststest/core/init.test.ts- Integration testsdocs/supported-tools.md- Documentation update.gitignore- Add .trae/ entry.changeset/add-trae-command-adapter.md- ChangesetTesting
pnpm exec tsc --noEmit- TypeScript check passespnpm run lint- Lint passespnpm run build- Build succeedsZSH="" pnpm test- All tests pass (1496/1496)openspec init --tools trae- Generates commands correctlyRelated
Summary by CodeRabbit
New Features
Documentation
Tests
Chores